<template>
    <!-- 每一类商品列表 -->
    <div class="centerContent" v-for="itemList in goodsCategoryItemList" :key="itemList.category.id">
        <!-- 列表标题 -->
        <div class="centerContentHeader">
            <div class="text5" v-if="titleShowYc">
                {{ itemList.category.name }}
            </div>
            <div class="text6">
                {{ itemList.category.frontName }}
            </div>
        </div>
        <!-- 详细商品卡片 -->
        <ul class="contentList">
            <!-- 单个商品卡片 -->
            <GoodCard v-for="item in itemList.itemList" :key="item.id" :item="item"></GoodCard>
        </ul>
    </div>
</template>

<script lang="ts">
import { defineComponent } from "vue"
export default defineComponent({
    name: '',
})
</script>

<script lang="ts" setup>
import type { IgoodCard } from "@/api/homeApi"
import GoodCard from "@/components/GoodCard/index.vue"
import { computed } from "vue";

const props = defineProps<{
    goodsCategoryItemList:IgoodCard[],
    titleShowYc:boolean
}>()

const goodsCategoryItemList = computed(()=>{
    return props.goodsCategoryItemList
})
const titleShowYc=computed(()=>{
    return props.titleShowYc
})
</script>

<style lang="less" scoped>

  /* 商品 */
.centerContent {
background-color: #fff;
margin-bottom: 10px;

/* 列表标题 */
.centerContentHeader {
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
    height: 60px;

    .text5 {
    font-size: 16px;
    }

    .text6 {
    margin-top: 6px;
    font-size: 12px;
    color: rgb(153, 153, 153);
    }
}

/* 详细商品卡片 */

.contentList {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;

    // 单个商品卡片
    .contentGoods {
    position: relative;
    width: 172.5px;
    padding-left: 10px;
    padding-bottom: 26px;

    // 商品图片
    .contentGoodImg {
        width: 100%;
        height: 172.5px;
        border-radius: 10px;
    }

    .contentGoodText {
        font-size: 14px;
        line-height: 20px;

        .logo1 {
        height: 15px;
        position: relative;
        top: 2px;
        }

    }

    .contentGoodRedpaper {
        border: 1px solid #d6d6d6;
        border-radius: 10px;
        width: 62px;
        height: 15px;
        line-height: 15px;
        padding-left: 3px;
        vertical-align: middle;
        margin-bottom: 10px;

        .logo2 {
        height: 10px;
        position: relative;
        top: 1px;
        }
    }

    .contentGoodPrice {
        color: #fa1e32;
        height: 30px;
        font-weight: bolder;

        .text1 {
        font-size: 20px;
        }

        .text2 {
        font-weight: normal;
        color: rgb(153, 153, 153);
        }
    }

    .contentGoodActivity {
        position: relative;
        height: 23px;
        align-items: center;
        padding: 0 3px;
        font-weight: bolder;
        border-radius: 10px;
        background-color: rgb(255, 233, 235);
        display: inline-block;

        .Text3 {
        display: inline-block;
        color: white;
        padding: 2px 5px;
        border-radius: 10px;
        background-color: rgb(350, 30, 50);
        }

        .Text4 {
        display: inline-block;
        padding: 0 3px;
        color: rgb(250, 30, 50);
        }

        .logo3 {
        position: absolute;
        top: -6px;
        left: 13px;
        }
    }

    .logo4 {
        position: absolute;
        width: 52.5px;
        height: 27px;
        top: 5px;
        right: 5px;
    }
    }
}
}

/* 特殊 */
.showNO {
  display: none;
}

.showWidth {
  width: 100%;
}

::v-deep .van-swipe__indicator {
  border-radius: 0;
  width: 20px;
  height: 2px;
}

</style>